// @ts-ignore
import { request } from "./request";
const nextApi = {

    // ------------------------ 用户登录 ----------------
    checkCode: () => {
        return request<{ captcha: string }>({
            url: '/captchaImage',
            method: 'get',
        })
    },
    userLogin: (data: { password: string; name: string; code: string }) => {
        return request({
            data,
            url: '/atUser/pcLogin',
            method: 'post',
        })
    },
    getUserInfo:(token:string)=>{
        const params: any = {
            url: '/atPcUser/findLoginUserInfo',
            method: 'get',
            headers:{token}
        }
        return request(params)
    },
    changePassword: (data: any) => {
        return request({
            data,
            url: '/atFrontUser/updatePersonageInfo',
            method: 'put',
        })
    },
    // ------------------------ 需求管理 ----------------
    addDemand: (data: any) => {
        return request({
            data,
            url: `/atDemand/addDemand`,
            method: 'post',
        })
    },
    getDemandList: (params: any) => {
        return request({
            params,
            url: '/atDemand/findDemand',
            method: 'get',
        })
    },
    subAuditDemand: (data: any) => {
        return request({
            data,
            url: `/atDemand/submitDataAudit`,
            method: 'post',
        })
    },
    subAuditAch: (data: any) => {
        return request({
            data,
            url: `/atAchievement/submitDataAudit`,
            method: 'post',
        })
    },
    getBrokerList: (params: any) => {
        return request({
            params,
            url: `/atPcUser/findTechnologyBroker`,
            method: 'get',
        })
    },
    deleteDemand: (id: string) => {
        return request({
            url: `/atDemand/removeDemandById/${id}`,
            method: 'delete',
        })
    },
    cancelDemand: (id: string) => {
        return request({
            params: { id },
            url: `/atDemand/cancelDemand`,
            method: 'get',
        })
    },
    getDemandAuthList: (params: any) => {
        return request({
            params,
            url: `/atDemand/findDemandAudit`,
            method: 'get',
        })
    },
    setDemandAuth: (data: any) => {
        return request({
            data,
            url: `/atDemand/auditDemand`,
            method: 'post',
        })
    },
    // ------------------------ 成果管理 ----------------
    addAch: (data: any) => {
        return request({
            data,
            url: `/atAchievement/addAchievement`,
            method: 'post',
        })
    },
    getAchList: (params: any) => {
        return request({
            params,
            url: '/atAchievement/findAchievement',
            method: 'get',
        })
    },
    deleteAch: (id: string) => {
        return request({
            url: `/atAchievement/removeAchievementById/${id}`,
            method: 'delete',
        })
    },
    cancelAch: (id: string) => {
        return request({
            params: { id },
            url: `/atAchievement/cancelAchievement`,
            method: 'get',
        })
    },
    getActAuthList: (params: any) => {
        return request({
            params,
            url: `/atAchievement/findAchievementAudit`,
            method: 'get',
        })
    },
    setActAuth: (data: any) => {
        return request({
            data,
            url: `/atAchievement/auditAchievement`,
            method: 'post',
        })
    },
    // ------------------------ 对接审核 ----------------
    findAbutmentDetails: (params: any) => {
        return request({
            params,
            url: `/atPcAchievementDemand/findAbutmentDetails`,
            method: 'get',
        })
    },
    abutmentAudit: (data: any) => {
        return request({
            data,
            url: `/atPcAchievementDemand/abutmentAudit`,
            method: 'post',
        })
    },

    // ------------------------ 人员审核 ----------------
    getUserAuthList: (params: any) => {
        return request({
            params,
            url: `/atPcUser/findAccountAuditData`,
            method: 'get',
        })
    },
    setUserAuth: (data: any) => {
        return request({
            data,
            url: `/atPcUser/auditAccount`,
            method: 'put',
        })
    },
    // ------------------------ 公示信息 ----------------
    getAnMentList: (params: any) => {
        return request({
            params,
            url: `/atPcAchievementDemand/findAchievementFormula`,
            method: 'get',
        })
    },

    getAnMentDetail: (params: any) => {
        return request({
            params,
            url: `/atPcAchievementDemand/findAchievementFormula`,
            method: 'get',
        })
    },
    postFormulaAudit: (data: any) => {
        return request({
            data,
            url: `/atPcAchievementDemand/formulaAudit`,
            method: 'post',
        })
    },
    postFormula: (data: any) => {
        return request({
            data,
            url: `/atPcAchievementDemand/submitFormula`,
            method: 'post',
        })
    },
    cancelFormula: (data: any) => {
        return request({
            data,
            url: `/atPcAchievementDemand/cancelPublicity`,
            method: 'post',
        })
    },

    getAnPublicityInfo: (params: any) => {
        return request({
            params,
            url: `/atPcAchievementDemand/findPublicityInfo`,
            method: 'get',
        })
    },
    deleteAnPublicityInfo: (params: any) => {
        return request({
            params,
            url: `/atPcAchievementDemand/removePublicityInfo/${params.id}`,
            method: 'delete',
        })
    },
    // ------------------------ 系统设置 ----------------
    getSetting: (type: string) => {
        return request({
            params: { type },
            url: '/atPcAcademy/findAcademy',
            method: 'get',
        })
    },
    addSetting: (data) => {
        return request({
            data,
            url: '/atPcAcademy/addAcademy',
            method: 'post',
        })
    },
    delSetting: (id: string) => {
        return request({
            url: `/atPcAcademy/removeAcademyById/${id}`,
            method: 'delete',
        })
    },
    // ------------------------ 图片上传 ----------------
    uploadImage: (data: any) => {
        const params: any = {
            data,
            url: '/file/uploadImage',
            method: 'post',
        }
        if (process.env.NODE_ENV === 'development') {
            params.baseURL = 'https://zyykjcgzhxt.cdutcm.edu.cn/api/'
        }
        return request(params)
    },

    getAchievementMatching: (params: any) => {
        return request({
            params,
            url: '/atAchievement/findAchievementMatching',
            method: 'get',
        })
    },
    getDemandMatching: (params: any) => {
        return request({
            params,
            url: '/atDemand/findDemandAbutment',
            method: 'get',
        })
    },
    matchAch: (data: any) => {
        return request({
            data,
            url: '/atPcAchievementDemand/achievementMatching',
            method: 'post',
        })
    },

    addFormulaInfo: (data: any) => {
        return request({
            data,
            url: `/atPcAchievementDemand/fillInFormulaInfo`,
            method: 'post',
        })
    },
    submitFormulaInfoAudit: (data: any) => {
        return request({
            data,
            url: `/atAchievement/submitFormulaInfoAudit`,
            method: 'post',
        })
    },
    submitAbutmentAudit: (data: any) => {
        return request({
            data,
            url: `/atPcAchievementDemand/submitAbutmentAudit`,
            method: 'post',
        })
    },
    addResourceAbutment: (data: any) => {
        return request({
            data,
            url: `/atPcResourceAbutment/addResourceAbutment`,
            method: 'post',
        })
    },
    getResourceAbutment: (params: any) => {
        return request({
            params,
            url: `/atPcResourceAbutment/findResourceAbutment`,
            method: 'get',
        })
    },
    deleteResourceAbutment: (id: string) => {
        return request({
            url: `/atPcResourceAbutment/removeResourceAbutment/${id}`,
            method: 'delete',
        })
    },

    addBanner: (data: any) => {
        return request({
            data,
            url: `/atPcBanner/addBanner`,
            method: 'post',
        })
    },
    getBannerList: (params?: any) => {
        return request({
            params,
            url: `/atPcBanner/findBanner`,
            method: 'get',
        })
    },
    deleteBanner: (id: string) => {
        return request({
            url: `/atPcBanner/removeBanner/${id}`,
            method: 'delete',
        })
    },
    getRecommendList: (params?: any) => {
        return request({
            params,
            url: `/atAchievement/recommendAchievement`,
            method: 'get',
        })
    },
    getAccRecommendList: (params?: any) => {
        return request({
            params,
            url: `/atDemand/recommendDemand`,
            method: 'get',
        })
    },

    getMyEntrustList: (params?: any) => {
        return request({
            params,
            url: `/atPcAchievementDemand/myEntrust`,
            method: 'get',
        })
    },
    findBigScreenData: (params?: any) => {
        return request({
            params,
            url: `/atAchievementTransition/findBigScreenData`,
            method: 'get',
        })
    },

    getAccountList: (params: any) => {
        return request({
            params,
            url: '/atPcUser/findPcAccountByCondition',
            method: 'get',
        })
    },
    getOrganizationList: (id: string) => {
        return request({
            params: { id },
            url: '/atPcOrganization/findUserdataByOrganizationId',
            method: 'get',
        })
    },
    getPermissionsById: (params: { organizationId?: string; userId?: string }) => {
        return request({
            params,
            url: '/atPcResource/findResourceByDepartmentIdAndUserId',
            method: 'get',
        })
    },
    editPermissions: (data: any) => {
        return request({
            data,
            url: '/atPcResource/giveDepartmentAndUserAddResource',
            method: 'post',
        })
    },
    deleteOrganization: (id: string) => {
        return request({
            url: `/atPcOrganization/removeOrganization/${id}`,
            method: 'delete',
        })
    },
    deleteAccount: (id: string) => {
        return request({
            url: `/psAccount/removePcUserById/${id}`,
            method: 'delete',
        })
    },
    editOrganization: (data: any) => {
        return request({
            data,
            url: '/atPcOrganization/addOrganization',
            method: 'post',
        })
    },
    editAccount: (data: any) => {
        return request({
            data,
            url: '/atPcUser/addPcAccount',
            method: 'post',
        })
    },
    getAccountDetail: (id: string) => {
        return request({
            params: { userId: id },
            url: '/atPcUser/findPcUserByPcUserId',
            method: 'get',
        })
    },
    getSystemLog: (params: any) => {
        return request({
            params: params,
            url: '/atLog/findLog',
            method: 'get',
        })
    },
    findAchievement: () => {
        return request({
            url: '/atAchievementTransition/findAchievement',
            method: 'get',
        })
    },
    chatUploadList: (params: any) => {
        const data: any = {
            params,
            url: '/repositoryFile/findUploadFile',
            method: 'get',
        }
        if (process.env.NODE_ENV === 'development') {
            data.baseURL = 'http://192.168.1.161:13265'
        }else{
            data.baseURL = 'https://zyykjcgzhxt.cdutcm.edu.cn/ai'
        }
        return request(data)
    },
    deleteChatUpload: (params: any) => {
        const data: any = {
            url: `/repositoryFile/removeFileInfo/${params.fileName}`,
            method: 'delete',
        }
        if (process.env.NODE_ENV === 'development') {
            data.baseURL = 'http://192.168.1.161:13265'
        }else{
            data.baseURL = 'https://zyykjcgzhxt.cdutcm.edu.cn/ai'
        }
        return request(data)
    },

    chatUpload: (data: any) => {
        const params: any = {
            data,
            url: '/repositoryFile/upload',
            method: 'post',
        }
        if (process.env.NODE_ENV === 'development') {
            params.baseURL = 'http://192.168.1.161:13265'
        }else{
            params.baseURL = 'https://zyykjcgzhxt.cdutcm.edu.cn/ai'
        }
        return request(params)
    },

}
export default nextApi
